package bsw.wode.service;

import java.util.Date;

import bsw.wode.dao.UserDAO;
import bsw.wode.entity.WodeUser;
import bsw.wode.id.UserID;

public class RegisterService extends BaseService{
	public boolean registerService(WodeUser newUser)
	{
		UserDAO userDAO = (UserDAO)this.getDAO("UserDAO");
		WodeUser existUser = userDAO.findUserByLoginName(newUser.getLoginName());
		
		if(existUser != null)
		{
			return false;
		}
		String newID = UserID.getNewID();
		newUser.setCode(newID);
		newUser.setCreateDate(new Date());
		newUser.setHeageImage("defaultHeadeImage.gif");
		userDAO.saveOrUpdate(newUser);
		UserID.removeID(newID);
		return true;
	}
}
